<html>
<head>
    <meta charset="utf-8">
    <title>{$web.title}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="{$assets}/layui/css/layui.css">
    <link rel="stylesheet" href="{$assets}/style.css">
    {block name="head"}{/block}
</head>
<body>
{block name="header"}
<div class="layui-header header header-doc" summer="">
    <div class="layui-main">
        <a class="logo" href="/doc">
            <img src="{$assets}/logo.png" alt="{$web.title}">
        </a>
        <div class="layui-form component">

            <select lay-search="" lay-filter="component">
                <option value="">搜索接口或选择模块</option>

                {if(isset($document))}
                <option value="" disabled>序言</option>
                {volist name="document" id='v'}
                <option value="/doc/document?name={$key}"
                <?php echo (input('name') == $key) ? 'selected' : ''; ?>
                >├──{$v.name}</option>
                {/volist}
                {/if}

                {volist name='menu' id='v'}
                <option value="/doc/module?name={$v.class}"
                <?php echo (input('name') == $v['class']) ? 'selected' : ''; ?>>{$v.title}</option>
                {if(isset($v.action))}
                {volist name='v.action' id='m'}
                <option value="/doc/action?name={$m.href}"
                <?php echo (input('name') == $m['href']) ? 'selected' : ''; ?> >├──{$m.title}</option>
                {/volist}
                {/if}
                {/volist}
            </select>
        </div>


        <ul class="layui-nav">

            <li class="layui-nav-item layui-this">
                <a href="/doc/">文档<!--  --></a>
            </li>
            <span class="layui-nav-bar"></span></ul>
    </div>
</div>
{/block}
{block name="main"}
<div class="layui-main site-inline">
    {include file="left" /}
    <div class="site-content">
        {block name="content"}{/block}
    </div>
</div>
{/block}
{block name="footer"}
{include file="footer" /}
{/block}

<script src="{$assets}/layui/layui.js"></script>

<script>

    layui.use(['element', 'layer', 'form', 'code'], function () {
        var element = layui.element
            , layer = layui.layer
            , $ = layui.jquery
            , form = layui.form;


        form.on('select(component)', function (item) {
            window.location.href = item.value;
        });

        layui.code({
            elem: 'pre' //默认值为.layui-code
            , title: 'ThinkPHP 6'
            , encode: true
            , about: false
        });

        //显示当前tab
        if (location.hash) {
            element.tabChange('doc', location.hash.replace(/^#/, ''));
        }
        element.on('tab(doc)', function () {
            var othis = $(this), layid = othis.attr('lay-id');
            if (layid) {
                location.hash = layid;
            }
        });
        form.on('select(tabVersion)', function (e) {
            window.location.href = "/doc/document?name=explain&version=" + e.value
        });
    });
</script>
{block name='js'}
{/block}
</body>
</html>